package Tools;

public class stopwatch {
	long startTime;
	long totalTime=0;
	boolean running;

	public stopwatch(){
		this.start();
	}

	public void pause(){
		totalTime+=System.currentTimeMillis()-startTime;
		running=false;
	}

	public void start(){
		if(running==false){
			startTime=System.currentTimeMillis();
			running=true;
		}
	}

	public long stop(){
		if(running==true){
			this.pause();
		}
		return totalTime;
	}

}
